﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mapping.ByCode.Conformist;

namespace Nhibernate.GuitarStore.Common
{
    public class Inventory
    {
        public Inventory() { }
        
        public virtual Guid Id { get; set; }
        public virtual Guid TypeId { get; set; }
        public virtual string Builder { get; set; }
        public virtual string Model { get; set; }
        public virtual int? QOH { get; set; }
        public virtual decimal? Cost { get; set; }
        public virtual decimal? Price { get; set; }
        //public virtual CurrencyAmount Cost { get; set; }
        //public virtual CurrencyAmount Price { get; set; }
        public virtual DateTime? Received { get; set; }
    }

    public class InventoryMap : ClassMapping<Inventory>
    {
        public InventoryMap()
        {
            Id<Guid>(x => x.Id, map =>
            {
                map.Column("ID");
                //map.Generator(Generators.GuidComb);
            });
            Property<Guid>(x => x.TypeId, map => map.Column("TYPEID"));
            Property<string>(x => x.Builder, map => map.Column("BUILDER"));
            Property<string>(x => x.Model, map => map.Column("MODEL"));
            Property<int?>(x => x.QOH, map => map.Column("QOH"));
            Property<decimal?>(x => x.Cost, map => map.Column("COST"));
            Property<decimal?>(x => x.Price, map => map.Column("PRICE"));
            Property<DateTime?>(x => x.Received, map => map.Column("RECEIVED"));

            //Property<Guitar>(x => x.Guitar, map => map.);
            //Component(x => x.Guitar, map => map.ManyToOne("TYPEID"));
            //Component<Guitar>(x => x.Guitar, map => map.ManyToOne<Guitar>(g => g.Id));
        }
    }
}
